<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="user-form">
                <div class="select-list">
                    <ul>
                        <li>
                            餐饮名称：<input type="text" name="goodsName"/>
                        </li>
                        <li>
                            评价人：<input type="text" name="userName"/>
                        </li>
                        <li class="select-time">
                            <label>评价时间： </label>
                            <input type="text" class="time-input" name="params[beginTime]"/>
                            <span>-</span>
                            <input type="text" class="time-input" name="params[endTime]"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('user:userGoodsRemark:edit')}]];
    var removeFlag = [[${@permission.hasPermi('user:userGoodsRemark:remove')}]];
    var prefix = ctx + "user/remark";

    // var datas = [[${@dict.getType('sys_normal_disable')}]];
    // formatter: function(value, row, index) {
    //     return $.table.selectDictLabel(datas, value);
    // }
    $(function() {
        var options = {
            url: prefix + "/listForSeller",
            removeUrl: prefix + "/remove",
            search: false,
            showSearch:false,
            showRefresh:false,
            showColumns:false,
            showToggle:false,
            showExport:false,
            onLoadSuccess:function(){
                $(".star_div").raty({
                    score: function () {
                        return $(this).data('score');
                    },
                    readOnly:true
                });
            },
            modalName: "商品评价",
            columns: [
                {
                    field : 'id',
                    title : '' ,
                    visible:false
                },

                {
                    field : 'goodsName',
                    title : '商品',
                    formatter: function(value, row, index) {
                        return '<img src="'+row.imgUrl+'" style="width: 80px;height: 80px;">'+value;
                    }
                },
                {
                    field : 'userName',
                    title : '评价人'
                },
                {
                    field : 'star',
                    title : '星级' ,
                    formatter: function(value, row, index) {
                        return '<div class="star_div" data-score="'+value+'"></div>';
                    }
                },
                {
                    field : 'msg',
                    title : '评价内容' ,
                    width: '250'
                },
                {
                    field : 'createTime',
                    title : '评价时间'
                },
                {
                    field : 'orderId',
                    title : '订单编号'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-link btn-sm ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-trash"></i>删除</a>');
                        return actions.join('');
                    },
                    visible:removeFlag !='hidden'
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>